function swap(array, a, b)
{
    var tmp;
    tmp = array[a];
    array[a] = array[b];
    array[b] = tmp;
}

function partition(array, range, pivotIndex)
{
    var left;
    var right;
    left = range[0];
    right = range[1];
    var pivotValue;
    pivotValue = array[pivotIndex];
    swap(array,pivotIndex,right);
    var storeIndex;
    storeIndex = left;
    var i;
    i = left;
    while(i < right )
    {
        if(array [ i ] < pivotValue )
        {
            swap(array,storeIndex,i);
            storeIndex+=1;
        }
        i+=1;
    }
    swap(array,right,storeIndex);
    return storeIndex;
}

function qsort(array, left, right)
{
    if(right > left )
    {
        var pivotNewIndex;
        var _new_Arr0 = [];
        _new_Arr0[0] = left;
        _new_Arr0[1] = right;
        pivotNewIndex = partition(array,_new_Arr0,left);
        qsort(array,left,pivotNewIndex-1);
        qsort(array,pivotNewIndex+1,right);
    }
}

function sort(array, len)
{
    qsort(array,0,len-1);
}

function ordered(array, len)
{
    var i;
    i = 1;
    while(i < len )
    {
        if(array [ i - 1 ] > array [ i ] )
        {
            return false;
        }
        i+=1;
    }
    return true;
}

var arr;
arr = [5,4,2,7,0,6,1,3,8,9];
var retcode;
retcode = {true:0,false:1};
var succ;
succ = true;
succ = succ && !ordered(arr,10);
sort(arr,10);
succ = succ && ordered(arr,10);
//console.log(retcode[succ]);
process.exit(retcode[succ]);